﻿

namespace Common.Result
{
    public class ResultHelper
    {
        private const int SUCCESS_CODE = 1;
        private const int ERROR_CODE = 0;
        public static ApiResult Success()
        {
            return new ApiResult()
            {
                Code = ResultHelper.SUCCESS_CODE,
            };
        }
        public static ApiResult Success(object data)
        {
            return new ApiResult()
            {
                Code = ResultHelper.SUCCESS_CODE,
                Data = data
            };
        }
        public static ApiResult Error(string msg)
        {
            return new ApiResult()
            {
                Code = ResultHelper.ERROR_CODE,
                Msg = msg
            };
        }
        public static ApiResult Error(string msg,int code)
        {
            return new ApiResult()
            {
                Code = code,
                Msg = msg
            };
        }
    }
}
